	<!-- MAIN -->
		<div class="main">
			<!-- MAIN CONTENT -->
	<div class="main-content">
		<div class="container-fluid">
			<h3 class="page-title">管理员页</h3>
			<div class="row">
				<form action="" method="post" role=form enctype="multipart/form-data">
					<div class="panel">
						<div class="panel-heading">
							<h3 class="panel-title">添加管理员</h3>
						</div>
						<div class="panel-body">
						<label>用户名</label>
						<input type="text" class="form-control username" name="username" placeholder="请输入名字">
						
						<label class="name" style="color:red">英文数字开头最少3位最多16位，不支持中文</label>

						<br>
						<label>密码</label>
						<input type="password" name="repassword" class="form-control password" placeholder="请输入密码">
						<label class="password" style="color:red">密码由3到17位的英文和数字组成</label>
						<br>
						<label>确认密码</label>
						<input type="password" name="repassword" class="form-control repassword" placeholder="请确认密码">
						<label class="repassword" style="color:red">请确认与原密码一致</label>
						
						<br>
						<label>手机号</label>
						<input type="text" class="form-control tel" name="tel" placeholder="请输入手机号">
						<label class="tel" style="color:red">请输入手机号码</label>
						<br>
						<label>邮箱</label>
						<input type="text" class="form-control mail" name="mail" placeholder="请输入邮箱">
						<label class="mail" style="color:red">请输入邮箱</label>
						<br>
                        <div class="panel-body">
						<div class="input-group">
						<label>头像上传</label>
							<input class="form-control" name="url[]" type="url" multiple>
							<span class="input-group-btn"><button class="btn btn-primary" >上传头像</button></span>
						</div>
                          <br>
                          <label>性别</label>
                          <select class="form-control">
                          <option value="1">男</option>
                          <option value="0">女</option>

                          </select>
                          <!-- <input type="text" name="sex" class="form-control" placeholder="请输性别:0代表女，1代表男"> -->
                            <br>
                         <label>年龄</label>
						<input type="text" name="age" class="form-control" placeholder="请输年龄">
						<span>请输入年龄</span>
						<br>
                          <label>请选择角色</label>
                          <select class="form-control" name="role_id">
                          <?php foreach($role as $v){ ?>
                          <option value="<?php echo $v[id]?>">
                           <?php echo $v['name']?>
                          </option>
                         <?php } ?>

                          </select>
                            <br>
						<input class="form-control" type="submit" value="提交">
						</form>
									<!-- <select class="form-control">
										<option value="cheese">Cheese</option>
										<option value="tomatoes">Tomatoes</option>
										<option value="mozarella">Mozzarella</option>
										<option value="mushrooms">Mushrooms</option>
										<option value="pepperoni">Pepperoni</option>
										<option value="onions">Onions</option>
									</select> -->
									
						
						
							<!-- END PROGRESS BARS -->
							<!-- INPUT GROUPS -->							
	</div>
<meta charset="utf-8">
<script src="resources/assets/jquery-3.2.1.min.js" ></script>
<script>
// alert(222);
// 用户名
$('.username').focus(function(){
    $('.name').text('请输入用户名');

})
$('.username').blur(function(){

	var txt = $(this).val();
	// alert(txt)
    
    var reg = /^[a-zA-Z0-9_]{2,16}$/;
    var result = reg.exec(txt);
  //  alert(result);
  // $('.name').text(' ');
  if(result==null){
  	$('.name').text('用户名不能为空');
  }else{
    $('.name').attr('style','color:green');
    
  	$('.name').text('通过');
  }	
})
// 密码
$('.password').focus(function(){
    $('.password').text('请输入密码由3到17位的英文和数字组成');

})
$('.password').blur(function(){
	var psw = $(this).val();
	// alert(psw);
    
    var reg = /^[a-zA-Z0-9_]{3,17}$/;
    var result = reg.exec(psw);
  //  alert(result);
  // $('.name').text(' ');
  if(result==null){
  	$('.password').text('密码不能为空');
}else{
    $('.password').attr('style','color:green');
    
  	$('.password').text('通过');
  }	

})
// 确认密码
$('.repassword').focus(function(){
	// alert(444)
    $('.repassword').text('请再次输入密码');


})
$('.repassword').keyup(function(){
	// alert(444)

	var repsw = $(this).val();
	var psw = $('.password').val();
	// alert(psw);

	
  if(repsw==psw){

  	$('.repassword').attr('style','color:green');
    
  	$('.repassword').text('通过');
  
}else{
   	$('.repassword').text('两次输入的密码不一样');
  }	

})
// 手机号码
$('.tel').focus(function(){
    $('.tel').text('请输入11位手机号');

})
$('.tel').keyup(function(){

	var num = $(this).val();
	// alert(txt)
    
    var reg = /^1[3-8]\d{9}/;
    var result = reg.exec(num);
  //  alert(result);
  // $('.name').text(' ');
  if(result==null){
  	$('.tel').text('请输入11位手机号');
  }else{
    $('.tel').attr('style','color:green');
    
  	$('.tel').text('通过');
  }	
})	

// 邮箱号
$('.mail').focus(function(){
    $('.mail').text('请输入正确的邮箱号');

})
$('.mail').blur(function(){

	var e = $(this).val();
	// alert(txt)
    
    var reg = /^(\w)+(\.\w+)*@(\w)+((\.\w+)+)$/;
    var result = reg.exec(e);
  //  alert(result);
  // $('.name').text(' ');
  if(result==null){
  	$('.mail').text('邮箱号或者邮箱格式错误');
  }else{
    $('.mail').attr('style','color:green');
    
  	$('.mail').text('通过');
  }	
})






</script>

















